//package com.wbl.gulimall.gateway.cors;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.cors.CorsConfiguration;
//import org.springframework.web.cors.reactive.CorsWebFilter;
//import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
//
///**
// * Author: 王博纶
// * Date: 2024/6/6 12:51
// * FileName: CorsConfiguration
// * Description: 跨域的配置类
// */
//@Configuration
//public class GulimallCorsConfiguration {
//
//    @Bean
//    public CorsWebFilter corsWebFilter(){
//        UrlBasedCorsConfigurationSource urlBasedCorsConfSource = new UrlBasedCorsConfigurationSource();
//        CorsConfiguration config = new CorsConfiguration();
//
//        // 1.配置跨域
//        config.addAllowedHeader("*"); // 允许哪些请求头跨域
//        config.addAllowedMethod("*"); // 允许哪些请求方法跨域
//        config.addAllowedOrigin("*"); // 允许哪些请求来源可以跨域
//        config.addAllowedOriginPattern("*");
//        config.setAllowCredentials(true); // 是否允许携带cookie信息
//
//        urlBasedCorsConfSource.registerCorsConfiguration("/**", config);
//        return new CorsWebFilter(urlBasedCorsConfSource);
//    }
//}
